package com.ruitu.ssmic.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.ruitu.arad.base.BaseFragment;
import com.ruitu.router_module.CommonUtils;
import com.ruitu.ssmic.ui.FeedbackActivity;
import com.ruitu.ssmic.ui.PersonalCenterActivity;
import com.ruitu.ssmic.R;
import com.ruitu.ssmic.ui.SettingsActivity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class MineFragment extends BaseFragment {


    public static MineFragment newInstance() {

        Bundle args = new Bundle();
        MineFragment fragment = new MineFragment();
        fragment.setArguments(args);
        return fragment;
    }

    private ImageView iv_setting;//设置
    private LinearLayout ll_login_and_personal_center;
    private RelativeLayout rl_feedback;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_mine, container, false);

        iv_setting = v.findViewById(R.id.iv_setting);
        ll_login_and_personal_center = v.findViewById(R.id.ll_login_and_personal_center);
        rl_feedback = v.findViewById(R.id.rl_feedback);
        iv_setting.setOnClickListener(this);
        ll_login_and_personal_center.setOnClickListener(this);
        rl_feedback.setOnClickListener(this);

        return v;
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);

        if (iv_setting == v) {
            startActivity(SettingsActivity.class);
        }

        //跳转登录或个人中心
        if (ll_login_and_personal_center == v) {
            if (CommonUtils.isLoginToActivity(getActivity())) {
                startActivity(PersonalCenterActivity.class);
            }
        }

        //反馈数据
        if (rl_feedback == v) {
//            if (CommonUtils.isLoginToActivity(getActivity())) {
                startActivity(FeedbackActivity.class);
//            }
        }

    }


}
